package com.example.serverconnect;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;

public abstract class BaseAsyncTask extends AsyncTask<String, String, String>
{
	private ITaskListener task;
	private ProgressDialog prgDlg;
	protected JSONObject obj;
	protected String baseUrl="http://10.0.2.2:81/serversale/";
	public BaseAsyncTask(ITaskListener listener,Context context)
	{
		this.task=listener;
		prgDlg=new ProgressDialog(context);
	}

	@Override
	protected void onPostExecute(String result)
	{
		// TODO Auto-generated method stub
		if(this.task!=null)
		{
			
			this.task.Completed(this.obj);
		}
		prgDlg.dismiss();
		super.onPostExecute(result);
	}

	@Override
	protected void onPreExecute()
	{
		// TODO Auto-generated method stub
		prgDlg.show();
		if(this.task!=null)
		{
			this.task.PreRun();
			
		}
		super.onPreExecute();
	}
	
}
